package com.woniu.mapper;

import com.woniu.pojo.Chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.vo.ChapterVO;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 课程 Mapper 接口
 * </p>
 *
 * @author xiaoruan
 * @since 2023-03-15
 */
public interface ChapterMapper extends BaseMapper<Chapter> {


    @Select("select id,title from wnxt_chapter where course_id = #{courseId}")
    @ResultType(ChapterVO.class)
    List<ChapterVO> findChaterBycourseId(String courseId);

    @Select("select max(sort) from wnxt_chapter where course_id = #{courseId} order by sort asc")
    Integer getmaxSort(String courseId);

/**
 *有问题
 * */
/*    @Select("SELECT c.id,c.title,v.id,v.title FROM wnxt_chapter c,wnxt_video v WHERE c.id = v.chapter_id AND c.course_id = #{courseId}")
    @ResultType(ChapterVO.class)
    List<ChapterVO> findALLChapter(String courseId);*/
}
